package com.liyang.microservice.service.controller;



import com.liyang.microservice.service.service.api.ConsumerService3;
import com.liyang.microservice.service.service.api.entity.User;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author liyang
 * @version 1.0
 * @Title: MyController
 * @description TODO
 * @date 2021/4/26 17:39
 */
@RestController
public class MyController2 {

    @Resource
    ConsumerService3 consumerService3;

    @GetMapping("/hello")
    public String helloName() {

        return consumerService3.service();
    }

    @GetMapping("/user/{id}")
    public User pathUser(@PathVariable("id") Long id) {
        return consumerService3.pathUser(id);
    }

    @GetMapping("/user")
    public User getUser(String name) {
        return consumerService3.getUser(name);
    }

    @PostMapping("/postUser")
    public User postUser(@RequestBody User user) {
        return consumerService3.postUser(user);
    }


}